package com.fw.system.admin.service.impl;

import java.util.List;
import com.fw.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.fw.common.IdXD;
import com.fw.system.admin.mapper.TbAnswerDetailMapper;
import com.fw.system.admin.domain.TbAnswerDetail;
import com.fw.system.admin.service.ITbAnswerDetailService;
import com.fw.utils.DateUtils;
/**
 * 答案Service业务层处理
 * 
 * @author yanwei
 * @date 2023-04-04
 */
@Service
public class TbAnswerDetailServiceImpl extends ServiceImpl<TbAnswerDetailMapper, TbAnswerDetail> implements ITbAnswerDetailService
{
    @Autowired
    private TbAnswerDetailMapper tbAnswerDetailMapper;

    @Autowired
    private IdXD idXD;

    /**
     * 查询答案
     * 
     * @param id 答案ID
     * @return 答案
     */
    @Override
    public TbAnswerDetail selectTbAnswerDetailById(String id)
    {
        return tbAnswerDetailMapper.selectTbAnswerDetailById(id);
    }

    /**
     * 查询答案列表
     * 
     * @param tbAnswerDetail 答案
     * @return 答案
     */
    @Override
    public List<TbAnswerDetail> selectTbAnswerDetailList(TbAnswerDetail tbAnswerDetail)
    {
        return tbAnswerDetailMapper.selectTbAnswerDetailList(tbAnswerDetail);
    }

    /**
     * 新增答案
     * 
     * @param tbAnswerDetail 答案
     * @return 结果
     */
    @Override
    public int insertTbAnswerDetail(TbAnswerDetail tbAnswerDetail)
    {
        tbAnswerDetail.setCreateTime(DateUtils.getNowDate());
        tbAnswerDetail.setId(idXD.nextId());
        return tbAnswerDetailMapper.insertTbAnswerDetail(tbAnswerDetail);
    }

    /**
     * 修改答案
     * 
     * @param tbAnswerDetail 答案
     * @return 结果
     */
    @Override
    public int updateTbAnswerDetail(TbAnswerDetail tbAnswerDetail)
    {
        return tbAnswerDetailMapper.updateTbAnswerDetail(tbAnswerDetail);
    }

    /**
     * 批量删除答案
     * 
     * @param ids 需要删除的答案ID
     * @return 结果
     */
    @Override
    public int deleteTbAnswerDetailByIds(String[] ids)
    {
        return tbAnswerDetailMapper.deleteTbAnswerDetailByIds(ids);
    }

    /**
     * 删除答案信息
     * 
     * @param id 答案ID
     * @return 结果
     */
    @Override
    public int deleteTbAnswerDetailById(String id)
    {
        return tbAnswerDetailMapper.deleteTbAnswerDetailById(id);
    }
}
